import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";

export default [
  {files: ["**/*.{js,mjs,cjs,ts,vue}"]},
  {languageOptions: { globals: globals.browser }},
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...pluginVue.configs["flat/essential"],
  {files: ["**/*.vue"], languageOptions: {parserOptions: {parser: tseslint.parser}}},
  eslintConfigPrettier,
  {
    ignores: [
      ".*",
      "*.lock",
      "*.log",
      "config/*",
      "public/*",
      "node_module",
      "dist",
      "build",
      "coverage",
    ]
  },
  {
    "rules": {
      // 要求使用 === 和 !==
      'eqeqeq': 'error',
      // 关闭组件命名规则
      "vue/multi-word-component-names": "off",
      // 关闭any类型提示
      "@typescript-eslint/no-explicit-any": "warn"
    }
  }
];